import redis

# 连接数据库
r = redis.StrictRedis(host='127.0.0.1', port=6379, db=0, decode_responses=True, password='123456')

# 设置
print(r.zadd('zset', {'a': 1, 'b': 2, 'c': 3}))

# 获取
print(r.zscore('zset', 'a'))

# 关闭
r.close()